﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mime;
using System.IO;

namespace mana.Web
{
    public static class MimeTypes
    {
        public static string GetFileMimeType(string fileName)
        {
            switch (Path.GetExtension(fileName))
            {
                case ".jpeg":
                case ".jpg":
                    return MediaTypeNames.Image.Jpeg;
                case ".gif":
                    return MediaTypeNames.Image.Gif;
                case ".tiff":
                    return MediaTypeNames.Image.Tiff;
                case ".txt":
                    return MediaTypeNames.Text.Plain;
                case ".xml":
                    return MediaTypeNames.Text.Xml;
                case ".pdf":
                    return MediaTypeNames.Application.Pdf;
                case ".rtf":
                    return MediaTypeNames.Application.Rtf;
                case ".zip":
                    return MediaTypeNames.Application.Zip;
                default:
                    return MediaTypeNames.Application.Octet;
            }
        }
    }
}
